import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '计量单位编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '计量单位名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '所属量纲',
    align:"center",
    dataIndex: 'oppdimen_dictText'
   },
   {
    title: '是否基本单位',
    align:"center",
    dataIndex: 'basecodeflag',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '换算系数',
    align:"center",
    dataIndex: 'scalefactor'
   },
   {
    title: '小数位数',
    align:"center",
    dataIndex: 'bitnumber'
   },
   {
    title: '英文名称',
    align:"center",
    dataIndex: 'ename'
   },
   {
    title: '自定义项1',
    align:"center",
    dataIndex: 'def1'
   },
   {
    title: '自定义项2',
    align:"center",
    dataIndex: 'def2'
   },
   {
    title: '自定义项3',
    align:"center",
    dataIndex: 'def3'
   },
   {
    title: '自定义项4',
    align:"center",
    dataIndex: 'def4'
   },
   {
    title: '自定义项5',
    align:"center",
    dataIndex: 'def5'
   },
   {
    title: '自定义项6',
    align:"center",
    dataIndex: 'def6'
   },
   {
    title: '自定义项7',
    align:"center",
    dataIndex: 'def7'
   },
   {
    title: '自定义项8',
    align:"center",
    dataIndex: 'def8'
   },
   {
    title: '自定义项9',
    align:"center",
    dataIndex: 'def9'
   },
   {
    title: '自定义项10',
    align:"center",
    dataIndex: 'def10'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '计量单位编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '计量单位名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '所属量纲',
    field: 'oppdimen',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"dimension"
     },
  },
  {
    label: '是否基本单位',
    field: 'basecodeflag',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '换算系数',
    field: 'scalefactor',
    component: 'InputNumber',
  },
  {
    label: '小数位数',
    field: 'bitnumber',
    component: 'InputNumber',
  },
  {
    label: '英文名称',
    field: 'ename',
    component: 'Input',
  },
  {
    label: '自定义项1',
    field: 'def1',
    component: 'Input',
  },
  {
    label: '自定义项2',
    field: 'def2',
    component: 'Input',
  },
  {
    label: '自定义项3',
    field: 'def3',
    component: 'Input',
  },
  {
    label: '自定义项4',
    field: 'def4',
    component: 'Input',
  },
  {
    label: '自定义项5',
    field: 'def5',
    component: 'Input',
  },
  {
    label: '自定义项6',
    field: 'def6',
    component: 'Input',
  },
  {
    label: '自定义项7',
    field: 'def7',
    component: 'Input',
  },
  {
    label: '自定义项8',
    field: 'def8',
    component: 'Input',
  },
  {
    label: '自定义项9',
    field: 'def9',
    component: 'Input',
  },
  {
    label: '自定义项10',
    field: 'def10',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  code: {title: '计量单位编码',order: 0,view: 'text', type: 'string',},
  name: {title: '计量单位名称',order: 1,view: 'text', type: 'string',},
  oppdimen: {title: '所属量纲',order: 2,view: 'radio', type: 'string',},
  basecodeflag: {title: '是否基本单位',order: 3,view: 'switch', type: 'string',},
  scalefactor: {title: '换算系数',order: 4,view: 'number', type: 'number',},
  bitnumber: {title: '小数位数',order: 5,view: 'number', type: 'number',},
  ename: {title: '英文名称',order: 6,view: 'text', type: 'string',},
  def1: {title: '自定义项1',order: 7,view: 'text', type: 'string',},
  def2: {title: '自定义项2',order: 8,view: 'text', type: 'string',},
  def3: {title: '自定义项3',order: 9,view: 'text', type: 'string',},
  def4: {title: '自定义项4',order: 10,view: 'text', type: 'string',},
  def5: {title: '自定义项5',order: 11,view: 'text', type: 'string',},
  def6: {title: '自定义项6',order: 12,view: 'text', type: 'string',},
  def7: {title: '自定义项7',order: 13,view: 'text', type: 'string',},
  def8: {title: '自定义项8',order: 14,view: 'text', type: 'string',},
  def9: {title: '自定义项9',order: 15,view: 'text', type: 'string',},
  def10: {title: '自定义项10',order: 16,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}